package view;

import java.awt.BorderLayout;

import javax.swing.JFrame;

import modell.Knapp;
import modell.Urverk;
import modell.Viser;

public class SekundKlokke extends JFrame {

	private static final long serialVersionUID = -4464358460865902060L;
	private Knapp opp, ned;
	private Viser sekund;
	private Display display;
	private Urverk ur;
	private StoppeKnapp startStopp;
	
	private final int maks_sekund = 59;
	private final int starttid = 0;
	
	public SekundKlokke(){
		super("Klokkeprogram");
		display = new Display();
		sekund = new Viser(maks_sekund, starttid);
		sekund.leggTilLytter(display);
		
		ur = new Urverk(sekund);
		
		startStopp = new StoppeKnapp(ur);
		opp = new KnappOpp(sekund);
		ned = new KnappNed(sekund);
		
		setLayout(new BorderLayout());
		
		add(opp, BorderLayout.EAST);
		add(ned, BorderLayout.WEST);
		add(startStopp, BorderLayout.SOUTH);
		add(display, BorderLayout.CENTER);
		
		setSize(100, 100);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setVisible(true);
		ur.start();
	}
	
	public static void main(String[] args) {
		new SekundKlokke();
	}

}
